package com.daydayup.learn.aop;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class PayAspect {

    @Before("execution(public void com.daydayup.learn.aop.PayServiceImpl.pay(..))")
    public void beforeNotify() {
        System.out.println("-------@Before通知   ");
    }

    @After("execution(public void com.daydayup.learn.aop.PayServiceImpl.pay(..))")
    public void afterNotify() {
        System.out.println("-------@After通知   ");
    }

    @AfterReturning("execution(public void com.daydayup.learn.aop.PayServiceImpl.pay(..))")
    public void afterReturningNotify() {
        System.out.println("-------@AfterReturning通知   ");
    }

    @AfterThrowing("execution(public void com.daydayup.learn.aop.PayServiceImpl.pay(..))")
    public void afterThrowingNotify() {
        System.out.println("-------@AfterThrowing通知   ");
    }

    @Around("execution(public void com.daydayup.learn.aop.PayServiceImpl.pay(..))")
    public Object aroundNotify(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        Object retValue = null;
        System.out.println("-------@Around通知  AAAAAAAA ");
        retValue = proceedingJoinPoint.proceed();
        System.out.println("-------@Around通知  BBBBBBBB ");
        return retValue;
    }
}
